package com.faithbj.common.utils;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.faithbj.common.dao.DictionaryDao;
import com.faithbj.common.model.Dictionary;
import com.google.common.collect.ImmutableMap;

/**
 * @author jrn E-mail: rinanjin@gmail.com
 * @version 0.1 
 * 创建时间：2012-6-29 下午09:21:20
 * 类说明
 */
@Component("dictionaryUtil")
@Transactional
public class DictionaryUtil
{
	@Resource
	private DictionaryDao dictionaryDao;
	
	public static Map<String,String> idTypeMap=new HashMap<String,String>();
	
	
	public static Map<String,String> educationMap=new HashMap<String,String>();
	
	
	
	public static ImmutableMap<String,String> marryMap = ImmutableMap.of(  
			"01", "结婚",
			"02", "未婚",
			"03", "离婚",
			"04", "丧偶"
	);  
	
	/**
	 * 通过类型名称获取字典列表
	 * 
	 * @param typeName 类型名称
	 * 
	 * @return
	 */
	@Transactional(readOnly=true)
	public List<Dictionary> getListByTypeName(String typeName)
	{
		return dictionaryDao.getListByTypeName(typeName);
	}
	

	
	static{
		idTypeMap.put("01", "身份证");
		idTypeMap.put("02", "护照");
		idTypeMap.put("03", "居住证");
		idTypeMap.put("04", "军官证");
		idTypeMap.put("05", "出生证");
		idTypeMap.put("06", "绿卡");
		idTypeMap.put("07", "港澳通行证");
		idTypeMap.put("08", "其他证件");
		
		educationMap.put("01", "博士");
		educationMap.put("02", "硕士");
		educationMap.put("03", "本科");
		educationMap.put("04", "大专、高职");
		educationMap.put("05", "高中");
		educationMap.put("06", "中专、职校");
		educationMap.put("07", "初中");
		educationMap.put("08", "小学");
		educationMap.put("09", "其它");
		educationMap.put("10", "其他证件");
		
	}
	

}
